package com.zztl.infiniteBand

import android.content.Context

import com.bumptech.glide.GlideBuilder
import com.bumptech.glide.annotation.GlideModule
import com.bumptech.glide.load.engine.cache.InternalCacheDiskCacheFactory
import com.bumptech.glide.load.engine.cache.LruResourceCache
import com.bumptech.glide.module.AppGlideModule

/**
 * @desc
 * @auth ${user}
 * @time 2018/9/27  17:20
 */
@GlideModule
class GlideModel : AppGlideModule() {
    override fun applyOptions(context: Context, builder: GlideBuilder) {
        val memoryCacheSizeBytes = 1024 * 1024 * 20 // 20mb
        val diskCacheSizeBytes = 1024 * 1024 * 100  //100 MB
        builder.setMemoryCache(LruResourceCache(memoryCacheSizeBytes.toLong()))
                .setDiskCache(InternalCacheDiskCacheFactory(context, diskCacheSizeBytes.toLong()))
    }

    override fun isManifestParsingEnabled(): Boolean {
        return false
    }

}
